package com.aw.puzzle.dropboxdiet;

import java.util.List;

/**
 * User: gmc
 * Date: 29/01/11
 */
public abstract class AbstractActivityGroupProvider {
    protected List<Activity> activities;
    protected CombinationsGenerator combinationsGenerator;

    public AbstractActivityGroupProvider(List<Activity> activities) {
        this.activities = activities;
        combinationsGenerator = new CombinationsGenerator();
    }

    public abstract ActivityGroup getNextGroup();


    protected ActivityGroup getNewGroupBasedOn(int[] newCombination) {
        if (activities.size()==0){
            return null;
        }
        ActivityGroup newGroup = new ActivityGroup(newCombination);
        for (int i : newCombination) {
            newGroup.addActivity(activities.get(i));
        }
        return newGroup;
    }

}
